package oa.web.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

import oa.web.dao.BaseDao;
import oa.web.dao.EmployeeDao;
import oa.web.pojo.Employee;

@Repository
public class EmployeeDaoImpl extends BaseDao implements EmployeeDao{

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;
	
	@Override
	public Employee findById(int empId) {
		Employee emp = (Employee) getSqlMapClientTemplate().queryForObject(getNameSpace() + "getEmployeeById", empId);
		return emp;
	}

	@Override
	public List<Employee> findAll() {
		List<Employee> emps = getSqlMapClientTemplate().queryForList(getNameSpace() + "getEmployees");
		return emps;
	}
	
	@Override
	public String getNameSpace() {
		return "employee.";
	}

}
